package com.lrl.naivete.controller;

import com.lrl.common.constant.MessageBean;
import com.lrl.common.constant.MessageConstant;
import com.lrl.common.constant.StatusConstant;
import com.lrl.utils.qiniu.QiNiuUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class FileController {

    @RequestMapping("/upload.lrl")
    public String upload(MultipartFile file) {
        MessageBean<String> msg = MessageBean.create(StatusConstant.SUCCESS, MessageConstant.UPLOAD_SUCCESS, String.class);
        QiNiuUtil.uploadMultipartFile(file,file.getOriginalFilename(),true);
        return msg.toJson();
    }
}
